package persistence.impl;

import persistence.DBUtil;
import persistence.LogDao;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class LogDaoImpl implements LogDao {

    private final String GET_USER_ACTION="INSERT INTO LOG VALUES(?,?,?)";

    @Override
    public void getUserAction(String userid,String action,String data) {
        try{
            Connection connection= DBUtil.getConnection();
            PreparedStatement preparedStatement=connection.prepareStatement(GET_USER_ACTION);
            preparedStatement.setString(1,userid);
            preparedStatement.setString(2,action);
            preparedStatement.setString(3,data);

            preparedStatement.executeUpdate();


            DBUtil.closeStatement(preparedStatement);
            DBUtil.closeConnection(connection);
        }catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}
